import {request} from '@umijs/max';
import * as API from "@/services";
import {JournaEditor_Sta, JournalArticleAccess_Sta, queryFrontArticlesByEs} from "@/services";


/** 期刊 分页检索请求 */
export async function queryFrontJournals(params: API.FrontJournalPageQueryParams): Promise<API.RespPageResult<API.FrontJournal>> {
    return request('/api/v1/front/journal', {
        params,
    });
}

export async function queryFrontJournalsByEs(params: API.FrontJournalEsPageQueryParams): Promise<API.RespPageResult<API.FrontJournal>> {
  return request('/api/v1/front/journal/eslist/v2', {
    params,
  });
}


/** 期刊 详情请求 */
export async function queryFrontJournal(bizId: API.EntityId): Promise<API.RespResult<API.FrontJournal>> {
    return request(`/api/v1/front/journal/${bizId}`);
}

/** 访问情况统计 */
export async function queryFrontJournalAccessNum(bizId: API.EntityId): Promise<API.RespListResult<API.JournalArticleAccess_Sta>> {
  return request(`/api/v1/front/journal/journal/${bizId}/access-num`);
}

/** 编辑情况统计 */
export async function queryFrontJournalEditorNum(params: {
  journalId: API.EntityId,
  startDate?: string,
  endDate?: string,
}): Promise<API.RespResult<API.JournaEditor_Sta>> {
  return request(`/api/v1/front/journal/journal/${params.journalId}/editor-num`, {
    params,
  });
}
